home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 8542 / 8542.xpi / chrome / lastpass.jar / content / addfield.js < prev    next >
Text File  |  2010-02-14  |  2KB  |  9 lines

  1. this.addfield_window_load=function(H,A){H.title=LP.lpgs("Add Field");H.documentElement.getButton("accept").setAttribute("label",LP.lpgs("OK"));H.documentElement.getButton("cancel").setAttribute("label",LP.lpgs("Cancel"));LP.sr(H,"namelabel","value","Name");LP.sr(H,"typelabel","value","Field Type");LP.sr(H,"formnamelabel","value","Form Name");
  2. var B=A.arguments;if(B){if(B.length>0){H.id=B[0]}if(B.length>1){H.fieldsdoc=B[1]}}var F=H.getElementById("typepopup");var G=H.createElement("menuitem");G.setAttribute("label",LP.lpgs("Text"));F.appendChild(G);G=H.createElement("menuitem");G.setAttribute("label",LP.lpgs("Password"));F.appendChild(G);G=H.createElement("menuitem");
  3. G.setAttribute("label",LP.lpgs("Select"));F.appendChild(G);G=H.createElement("menuitem");G.setAttribute("label",LP.lpgs("Checkbox"));F.appendChild(G);var D=H.getElementById("type");D.selectedIndex=0;if(lpaccts[H.id]&&lpaccts[H.id].save_all){H.getElementById("formnamerow").hidden=false;var E="";if(lpaccts[H.id].logins.length>0){for(var C=0;
  4. C<lpaccts[H.id].logins[0].otherfields.length;C++){if(C==0){E=lpaccts[H.id].logins[0].otherfields[C].formname}else{if(lpaccts[H.id].logins[0].otherfields[C].formname!=E){E="";break}}}}H.getElementById("formname").value=E}};this.addfield_accept_click=function(L,K){var C=L.getElementById("name").value;var H=L.getElementById("type").selectedIndex;
  5. var I=L.getElementById("formname").value;if(C==""){LP.alert(LP.lpgs("You must enter a name."),K);return false}var D=lpaccts[L.id];var M=null;var F=null;var G=null;if(D&&D.logins.length>0){M=D.logins[0];G=D.save_all?M.otherfields:M.fields;F=M.urid;for(var E=0;E<G.length;E++){var B=G[E];if(B&&B.name==C&&(!D.save_all||B.formname==I)){LP.alert(LP.lpgs("You must enter a unique name."),K);
  6. return false}}}var J="text";if(H==1){J="password"}else{if(H==2){J="select-one"}else{if(H==3){J="checkbox"}}}var B=null;if(M){B=new lpfieldinfo();B.name=C;B.type=J;B.value="";if(D&&D.save_all){B.formname=I}G[G.length]=B}if(B&&typeof(L.fieldsdoc)!="undefined"){var N=B.type+"_"+B.name+"_"+F;if(D&&D.save_all){N=B.formname+"_"+N
  7. }LP.DrawField(L.fieldsdoc,L.fieldsdoc.getElementById("fields"),N,B,D,F,false,true)}var A=LP.lp_base+"fields.php?add=1&aid="+LP.en(D.id)+"&urid="+LP.en(F)+"&name="+LP.en(C)+"&type="+LP.en(J);if(D&&D.save_all){A+="&formname="+LP.en(I)}LP.lpMakeRequest(A,"",lpFieldsResponse);return true};this.addfield_cancel_click=function(B,A){return true
  8. };
  9.